from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone

from contract.model.parter import Partner


# Create your models here.
class Post(models.Model):
    TOTAL_STATUS = (
        (0,'有效'),
        (1,'失效'),
    )
    title = models.CharField(max_length=250,verbose_name="合同名称")
    begindate = models.DateField(default=timezone.now,verbose_name="合同开始时间")
    enddate = models.DateField(default=timezone.now,verbose_name="合同到期时间")
    cost = models.IntegerField(default=0,verbose_name="合同费用")
    is_expire = models.PositiveIntegerField(choices=TOTAL_STATUS,default=0,verbose_name="合同状态")
    partner_name = models.ForeignKey(Partner,related_name="contract_partner",verbose_name="合作方")
    contract_holder = models.ForeignKey(User,related_name="contract_holder_posts",verbose_name="合同签订人")
    file = models.FileField(verbose_name="合同文件")
    operater = models.ForeignKey(User,related_name="contract_operater",verbose_name="合同录入人")
    class Meta:
        verbose_name = u'合同明细'
        verbose_name_plural = u'合同明细'
